package org.neusoft.auth.controller;


import org.neusoft.auth.entity.CommonResult;
import org.neusoft.auth.entity.Emp;
import org.neusoft.auth.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

@RestController
@CrossOrigin(origins ="*",maxAge = 3600)
public class EmpController {
    @Autowired
    EmpService empService;

    @RequestMapping("/emp/img/{logid}")
    public CommonResult putEmpImg(MultipartFile file , @PathVariable("logid" ) String logid) {
        System.out.println(logid);
        System.out.println(file.getOriginalFilename());
        return  null;
    }

    @RequestMapping("/logid/isexists/{logid}")
    public CommonResult logidIsExists(@PathVariable("logid") String logid) {
        return empService.logidIsExists(logid);
    }

    @PostMapping(value = "/emp" ,produces = "application/json;charset=UTF-8")
    public CommonResult postEmp(@RequestBody Emp emp  ) {
        CommonResult r  = empService.putEmp(emp);
        return r;
    }


}
